<!DOCTYPE html>












  


<html class="theme-next muse use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">












  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=7.2.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=7.2.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=7.2.0">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=7.2.0" color="#222">






<link rel="stylesheet" href="/blog/css/main.css?v=7.2.0">






<link rel="stylesheet" href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">








<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Muse',
    version: '7.2.0',
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"未找到内容: ${query}","hits_stats":"${hits} 搜索耗时 ${time} ms"}
    },
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    }
  };
</script>

  <meta name="description" content="基本信息机器列表   服务器  服务器用途    deepwatch01 1.1.1.1 k8s 集群、ELK集群   deepwatch01 1.1.1.2 k8s 集群、ELK集群   deepwatch03 1.1.1.3 k8s 集群、ELK集群   deepwatch04 1.1.1.4 性能数据存储graphite集群、sensu-server节点   deepwatch05 1.1.">
<meta name="keywords" content="运维">
<meta property="og:type" content="article">
<meta property="og:title" content="自动化部署文档">
<meta property="og:url" content="https://diagram.gitee.io/blog/2019/07/24/2019-7-18 DeepWatch自动化部署文档(1) 112330/index.html">
<meta property="og:site_name" content="至美视觉">
<meta property="og:description" content="基本信息机器列表   服务器  服务器用途    deepwatch01 1.1.1.1 k8s 集群、ELK集群   deepwatch01 1.1.1.2 k8s 集群、ELK集群   deepwatch03 1.1.1.3 k8s 集群、ELK集群   deepwatch04 1.1.1.4 性能数据存储graphite集群、sensu-server节点   deepwatch05 1.1.">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="c:%5CUsers%5Cuser%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5C1562756434378.png">
<meta property="og:updated_time" content="2019-07-25T03:03:31.262Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="自动化部署文档">
<meta name="twitter:description" content="基本信息机器列表   服务器  服务器用途    deepwatch01 1.1.1.1 k8s 集群、ELK集群   deepwatch01 1.1.1.2 k8s 集群、ELK集群   deepwatch03 1.1.1.3 k8s 集群、ELK集群   deepwatch04 1.1.1.4 性能数据存储graphite集群、sensu-server节点   deepwatch05 1.1.">
<meta name="twitter:image" content="c:%5CUsers%5Cuser%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5C1562756434378.png">





  
  
  <link rel="canonical" href="https://diagram.gitee.io/blog/2019/07/24/2019-7-18 DeepWatch自动化部署文档(1) 112330/">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  
  <title>自动化部署文档 | 至美视觉</title>
  












  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">至美视觉</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
      
    

    

    <a href="/blog/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
      
    

    

    <a href="/blog/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
      
    

    

    <a href="/blog/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>

      
      
    </ul>
  

  
    

  

  
</nav>



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://diagram.gitee.io/blog/blog/2019/07/24/2019-7-18 DeepWatch自动化部署文档(1) 112330/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="peachlin">
      <meta itemprop="description" content="码农与UI设计师的博客 至美视觉">
      <meta itemprop="image" content="/blog/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="至美视觉">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">自动化部署文档

              
            
          </h1>
        

        <div class="post-meta">

          
          
          

          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2019-07-24 17:01:01" itemprop="dateCreated datePublished" datetime="2019-07-24T17:01:01+08:00">2019-07-24</time>
            </span>
          

          
            

            
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2019-07-25 11:03:31" itemprop="dateModified" datetime="2019-07-25T11:03:31+08:00">2019-07-25</time>
              </span>
            
          

          

          
            
            
          

          
          

          

          

          <br>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="基本信息"><a href="#基本信息" class="headerlink" title="基本信息"></a>基本信息</h1><h2 id="机器列表"><a href="#机器列表" class="headerlink" title="机器列表"></a>机器列表</h2><table>
<thead>
<tr>
<th align="center">服务器</th>
<th align="center"></th>
<th align="center">服务器用途</th>
</tr>
</thead>
<tbody><tr>
<td align="center">deepwatch01</td>
<td align="center">1.1.1.1</td>
<td align="center">k8s 集群、ELK集群</td>
</tr>
<tr>
<td align="center">deepwatch01</td>
<td align="center">1.1.1.2</td>
<td align="center">k8s 集群、ELK集群</td>
</tr>
<tr>
<td align="center">deepwatch03</td>
<td align="center">1.1.1.3</td>
<td align="center">k8s 集群、ELK集群</td>
</tr>
<tr>
<td align="center">deepwatch04</td>
<td align="center">1.1.1.4</td>
<td align="center">性能数据存储graphite集群、sensu-server节点</td>
</tr>
<tr>
<td align="center">deepwatch05</td>
<td align="center">1.1.1.5</td>
<td align="center">性能数据存储graphite集群、sensu-server节点</td>
</tr>
<tr>
<td align="center">deepwatch06</td>
<td align="center">1.1.1.6</td>
<td align="center">性能数据存储graphite集群、sensu-server节点</td>
</tr>
<tr>
<td align="center">deepwatch07</td>
<td align="center">1.1.1.7</td>
<td align="center">性能数据存储graphite集群</td>
</tr>
</tbody></table>
<h2 id="机器硬件要求"><a href="#机器硬件要求" class="headerlink" title="机器硬件要求"></a>机器硬件要求</h2><table>
<thead>
<tr>
<th>硬件名称</th>
<th>最低配置</th>
</tr>
</thead>
<tbody><tr>
<td>CPU</td>
<td>2.4GHZ，32核</td>
</tr>
<tr>
<td>内存</td>
<td>128G</td>
</tr>
<tr>
<td>硬盘</td>
<td>1T容量，SSD盘</td>
</tr>
<tr>
<td>网络</td>
<td>千兆网</td>
</tr>
</tbody></table>
<h2 id="其他要求"><a href="#其他要求" class="headerlink" title="其他要求"></a>其他要求</h2><a id="more"></a>
<p>yum 源</p>
<p>VIP：3个，k8s、Graphite、sensu</p>
<p>操作系统：BCLinux7.x</p>
<h2 id="模块说明"><a href="#模块说明" class="headerlink" title="模块说明"></a>模块说明</h2><table>
<thead>
<tr>
<th align="center">模块名称</th>
<th align="center">模块描述</th>
</tr>
</thead>
<tbody><tr>
<td align="center">Ansible</td>
<td align="center">自动化部署工具</td>
</tr>
<tr>
<td align="center">etcd</td>
<td align="center">用于保存 k8s 集群所有的网络配置和对象的状态信息</td>
</tr>
<tr>
<td align="center">docker</td>
<td align="center">应用容器引擎</td>
</tr>
<tr>
<td align="center">habor</td>
<td align="center">用于存在和分发Docker镜像</td>
</tr>
<tr>
<td align="center">k8s（kubernetes）</td>
<td align="center">用于自动部署，扩展和管理容器化应用程序的开源系统</td>
</tr>
<tr>
<td align="center">haproxy</td>
<td align="center">提供组件的负载均衡</td>
</tr>
<tr>
<td align="center">keepalived</td>
<td align="center">用于实现组件的高可用</td>
</tr>
<tr>
<td align="center">glusterfs</td>
<td align="center">一个可扩展的网络文件系统</td>
</tr>
<tr>
<td align="center">MySQL</td>
<td align="center">数据库，用于存放基础组件数据</td>
</tr>
<tr>
<td align="center">graphite</td>
<td align="center">用于存放性能数据</td>
</tr>
<tr>
<td align="center">sensu</td>
<td align="center">底层监控告警、采集组件</td>
</tr>
<tr>
<td align="center">elk</td>
<td align="center">日志采集组件</td>
</tr>
</tbody></table>
<h1 id="部署步骤"><a href="#部署步骤" class="headerlink" title="部署步骤"></a>部署步骤</h1><h2 id="0、安装包准备"><a href="#0、安装包准备" class="headerlink" title="0、安装包准备"></a>0、安装包准备</h2><p>1、epic-autoluke：DeepWatch 自动化部署安装包</p>
<p>2、各组件镜像，拷贝到对应目录下</p>
<table>
<thead>
<tr>
<th>组件名称</th>
<th>用途</th>
<th>对应目录</th>
</tr>
</thead>
<tbody><tr>
<td>BC_Deepwatch_epic-arlong.tar.gz</td>
<td>性能数据处理</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-brook.tar.gz</td>
<td>配置项</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-chopper.tar.gz</td>
<td>告警处理</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-config.tar.gz</td>
<td>组件配置数据中心</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-cp9.tar.gz</td>
<td>自动化运维</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-crab-core.tar.gz</td>
<td>用户中心</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-crab-extension.tar.gz</td>
<td>用户扩展功能</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-iruka.tar.gz</td>
<td>运维日志模块</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-kakashi.tar.gz</td>
<td>OpenStack数据同步</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-mihawk.tar.gz</td>
<td></td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-nami.tar.gz</td>
<td></td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-oauth-server.tar.gz</td>
<td>认证中心</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-rabbitmq.tar.gz</td>
<td>消息队列</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-thresholdrule.tar.gz</td>
<td>阈值告警</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-topology.tar.gz</td>
<td>拓扑展示</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-usopp.tar.gz</td>
<td></td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>BC_Deepwatch_epic-zebra.tar.gz</td>
<td>资源管理</td>
<td>epic-autoluke/roles/service/files/k8s_images/</td>
</tr>
<tr>
<td>graphite20180411.tar.gz</td>
<td>Graphite 镜像</td>
<td>epic-autoluke/roles/graphite/files/images/</td>
</tr>
<tr>
<td>epic_base.tar.gz</td>
<td>sensu所需基础镜像</td>
<td>epic-autoluke/roles/sensu/files/images/</td>
</tr>
<tr>
<td>keepalived-haproxy.tar.gz</td>
<td>sensu所需高可用组件镜像</td>
<td>epic-autoluke/roles/sensu/files/images/</td>
</tr>
<tr>
<td>rabbitmq-server.tar.gz</td>
<td>sensu所需消息队列镜像</td>
<td>epic-autoluke/roles/sensu/files/images/</td>
</tr>
<tr>
<td>elasticsearch.tar.gz</td>
<td>ELK所需镜像</td>
<td>epic-autoluke/roles/elk/files/images/</td>
</tr>
<tr>
<td>kibana.tar.gz</td>
<td>ELK所需镜像</td>
<td>epic-autoluke/roles/elk/files/images/</td>
</tr>
<tr>
<td>logstash.tar.gz</td>
<td>ELK所需镜像</td>
<td>epic-autoluke/roles/elk/files/images/</td>
</tr>
<tr>
<td>nginx.tar.gz</td>
<td>ELK所需镜像</td>
<td>epic-autoluke/roles/elk/files/images/</td>
</tr>
<tr>
<td>kafka.tar.gz</td>
<td>ELK所需镜像</td>
<td>epic-autoluke/roles/elk/files/images/</td>
</tr>
<tr>
<td>zookeeper.tar.gz</td>
<td>ELK所需镜像</td>
<td>epic-autoluke/roles/elk/files/images/</td>
</tr>
</tbody></table>
<h2 id="一、Ansible-安装配置"><a href="#一、Ansible-安装配置" class="headerlink" title="一、Ansible 安装配置"></a>一、Ansible 安装配置</h2><p>1、在上述机器中选择一台（以 <code>deepwatch01</code> 为例）安装 <code>Ansible</code>，安装方法可以参考 <a href="https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html" target="_blank" rel="noopener">Ansible 官网提供的方法</a></p>
<p>若机器有 yum 源，直接安装即可：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install ansible</span><br></pre></td></tr></table></figure>

<p>2、拷贝 <code>epic-autoluke</code> 文件夹到 <code>/app</code> 目录下，没有该目录请新建</p>
<p>3、登录 deepwatch01（安装 Ansible 的机器）</p>
<p>编辑文件 <code>/etc/ansible/ansible.cfg</code>，将变量 <code>host_key_checking</code> 设置为 <code>false</code></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[defaults]</span><br><span class="line">host_key_checking = false</span><br></pre></td></tr></table></figure>

<h2 id="二、环境信息配置"><a href="#二、环境信息配置" class="headerlink" title="二、环境信息配置"></a>二、环境信息配置</h2><p>1、登录 deepwatch01，进入 <code>/app/epic-autoluke/inventories/test/host_vars/</code>目录下，<code>NODE1.yml</code>、<code>NODE2.yml</code>、<code>NODE3.yml</code> 用于部署 k8s 相关组件；</p>
<p>2、编辑文件 <code>NODE1.yml</code> ，根据环境信息编辑变量：<code>region_name</code>、 <code>subnet_range</code>、<code>bond_name</code></p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 运行在 k8s 中的组件的镜像地址及镜像版本</span></span><br><span class="line"><span class="attr">arlong:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-arlong:0.1.117</span></span><br><span class="line"><span class="attr">brook:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-brook:201906141640</span></span><br><span class="line"><span class="attr">chopper:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-chopper:2019.05.23.01</span></span><br><span class="line"><span class="attr">config:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-config:0.1.13</span></span><br><span class="line"><span class="attr">crab_core:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-crab-core:release-1.3.1-2019010202</span></span><br><span class="line"><span class="attr">crab_extension:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-crab-extension:PEK-REL-1.3.1-20190422</span></span><br><span class="line"><span class="attr">iruka:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-iruka:1.2.4</span></span><br><span class="line"><span class="attr">kakashi:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-kakashi:1.2.4.6</span></span><br><span class="line"><span class="attr">mihawk:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-mihawk:release-1.4.2-2019030601</span></span><br><span class="line"><span class="attr">nami:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-nami:PEK-REL-1.3.1-20190416</span></span><br><span class="line"><span class="attr">oauth_server:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-oauth-server:release-1.3.1-20181227</span></span><br><span class="line"><span class="attr">rabbitmq:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/rabbitmq:3-management</span></span><br><span class="line"><span class="attr">thresholdrule:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-thresholdrule:0.1.26</span></span><br><span class="line"><span class="attr">topology:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-topology:1.2.4.1</span></span><br><span class="line"><span class="attr">usopp:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-usopp:19.05.24.01</span></span><br><span class="line"><span class="attr">zebra:</span> <span class="number">10.144</span><span class="number">.91</span><span class="number">.125</span><span class="string">/library/epic-zebra:pek-0523-3</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># region_name: 项目地名的缩写，比如上海-SH，北京-BJ，苏州-SZ</span></span><br><span class="line"><span class="attr">region_name:</span> <span class="string">SZ</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># subnet_range: 子网变化范围，例如 dw的三台机器：10.154.5.113，10.154.5.115，10.154.5.116, subnet_range=10.154.5.0/24</span></span><br><span class="line"><span class="attr">subnet_range:</span> <span class="number">10.154</span><span class="number">.5</span><span class="number">.0</span><span class="string">/24</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># VIP绑定的网卡</span></span><br><span class="line"><span class="attr">bond_name:</span> <span class="string">eth0</span></span><br></pre></td></tr></table></figure>

<p>3、编辑文件<code>NODE2.yml</code> <code>NODE3.yml</code>，根据环境信息编辑变量：<code>subnet_range</code>、<code>bond_name</code></p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># subnet_range: 子网变化范围</span></span><br><span class="line"><span class="attr">subnet_range:</span> <span class="number">10.154</span><span class="number">.5</span><span class="number">.0</span><span class="string">/24</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># VIP绑定的网卡</span></span><br><span class="line"><span class="attr">bond_name:</span> <span class="string">eth0</span></span><br></pre></td></tr></table></figure>

<p>4、编辑文件 <code>/app/epic-autoluke/inventories/test/hosts</code>，根据环境信息编辑相关变量，例如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br></pre></td><td class="code"><pre><span class="line"># ---------------------- 通用组件的配置信息 -------------------------------</span><br><span class="line"># 通过组件包括: mysql集群、k8s集群</span><br><span class="line">[general]</span><br><span class="line">NODE1 ansible_host=1.1.1.1</span><br><span class="line">NODE2 ansible_host=1.1.1.2</span><br><span class="line">NODE3 ansible_host=1.1.1.3</span><br><span class="line"></span><br><span class="line"># ----------------------  Sensu服务端集群 ---------------------------------</span><br><span class="line">[sensu]</span><br><span class="line">SENSU1 ansible_host=1.1.1.1</span><br><span class="line">SENSU2 ansible_host=1.1.1.2</span><br><span class="line">SENSU3 ansible_host=1.1.1.3</span><br><span class="line"></span><br><span class="line">[sensu:vars]</span><br><span class="line"># single：如果sensu集群是单节点部署</span><br><span class="line"># VIP_INTERFACE：keepalived的绑定的网卡名</span><br><span class="line"></span><br><span class="line">single=False</span><br><span class="line">VIP_INTERFACE=bond1</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"># ----------------------  Graphite服务端集群 ---------------------------------</span><br><span class="line">[graphite]</span><br><span class="line">node1 ansible_host=1.1.1.4</span><br><span class="line">node2 ansible_host=1.1.1.5</span><br><span class="line">node3 ansible_host=1.1.1.6</span><br><span class="line">node4 ansible_host=1.1.1.7</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"># --------------------------  Elk服务端集群 -----------------------------------</span><br><span class="line">[elk]</span><br><span class="line">ELK1 ansible_host=1.1.1.1</span><br><span class="line">ELK2 ansible_host=1.1.1.2</span><br><span class="line">ELK3 ansible_host=1.1.1.3</span><br><span class="line"></span><br><span class="line">[elk:vars]</span><br><span class="line"># EPC1： EPC第一个节点， 用于nginx 限制访问</span><br><span class="line"># DATA_PATH： 设置elasticsearch 数据目录</span><br><span class="line"># LOG_PATH： 设置elasticsearch 日志目录</span><br><span class="line">EPC1=1.1.1.1</span><br><span class="line">EPC2=1.1.1.2</span><br><span class="line">EPC3=1.1.1.3</span><br><span class="line">DATA_PATH=/opt/apps/data/elasticsearch</span><br><span class="line">LOG_PATH=/opt/apps/logs/elasticsearch</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"># -----------------------------  全局变量配置 -----------------------------------</span><br><span class="line">[all:vars]</span><br><span class="line"># POOL_ID：资源池ID</span><br><span class="line"># POOL_ID_ALIAS: 资源池编码</span><br><span class="line"># IP_VERSION: 可取值IPv4/IPv6，标识环境是IPv4环境还是IPv6环境</span><br><span class="line"># TYPE: 如果Graphite、Sensu是混合部署TYPE=Mixed，如果是分开部署TYPE=Independent</span><br><span class="line">#  Mixed: 是指graphite和sensu集群部署在三台节点上</span><br><span class="line">#  Independent：是指graphite和sensu集群独立、分开部署。比如1-3机器部署graphite，4-6机器部署sensu。</span><br><span class="line"># SENSU_HOST: Sensu集群VIP</span><br><span class="line"># GRAPHITE_HOST: Graphite集群VIP</span><br><span class="line"># EPC_HOST: EPC服务VIP</span><br><span class="line"></span><br><span class="line"># SSH Deepwatch节点的登录信息：</span><br><span class="line"># host_key_checking： 如果使用密码登录 必须设置 host_key_checking=False</span><br><span class="line"># ansible_ssh_user： 目前必须使用  root用户登录。</span><br><span class="line"># ansible_ssh_pass： 用户密码</span><br><span class="line"># ansible_ssh_port： ssh 登录端口</span><br><span class="line"># FILE_SERVER 不用关注</span><br><span class="line"></span><br><span class="line">POOL_ID=7b8f0f5e2fbb4d9aa2d5fd55466d638e</span><br><span class="line">POOL_ID_ALIAS=CPC-RP-NM-01</span><br><span class="line">IP_VERSION=IPv4</span><br><span class="line">TYPE=Independent</span><br><span class="line">SENSU_HOST=10.154.5.228</span><br><span class="line">GRAPHITE_HOST=10.154.5.228</span><br><span class="line">EPC_HOST=10.154.5.228</span><br><span class="line">FILE_SERVER=10.154.5.228</span><br><span class="line">host_key_checking=False</span><br><span class="line">ansible_ssh_user=root</span><br><span class="line">ansible_ssh_pass=Bcec@2018</span><br><span class="line">ansible_ssh_port=22</span><br></pre></td></tr></table></figure>

<h2 id="三、基础配置"><a href="#三、基础配置" class="headerlink" title="三、基础配置"></a>三、基础配置</h2><p>k8s 集群节点的 ssh 互信、ntp 时间同步、配置 iptables、防火墙等</p>
<p>1、登录 deepwatch01<br>进入 <code>/app/epic-autoluke</code> 目录下，执行如下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cp subs/* .</span><br><span class="line">ansible-playbook  -i inventories/test/hosts general.yml</span><br></pre></td></tr></table></figure>

<p>2、然后三台机器依次重启：<code>reboot</code></p>
<p>3、服务校验</p>
<ul>
<li>依次登录三台机器</li>
<li>输入 <code>hostname</code>，观察是否为 <code>deepwatch01</code>、<code>deepwatch02</code>、<code>deepwatch03</code></li>
<li>依次 ssh 登录deepwatch02、deepwatch03，观察是否可以免密登录</li>
<li>依次 <code>getenforce</code>，观察是否是 <code>Disabled</code></li>
<li>依次 <code>systemctl status firewalld</code>，观察是否是 <code>dead</code></li>
<li>依次 <code>date</code>，观察时间是否同步</li>
<li>依次 <code>iptables -nL</code></li>
</ul>
<h2 id="四、部署-etcd-集群"><a href="#四、部署-etcd-集群" class="headerlink" title="四、部署 etcd 集群"></a>四、部署 etcd 集群</h2><p>1、登录 deepwatch01</p>
<p>2、进入到 <code>/app/epic-autoluke</code> 目录下，执行如下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook  -i inventories/test/hosts etcd.yml</span><br></pre></td></tr></table></figure>

<blockquote>
<p>注： 如果执行过程中，在“Check etcd service”这步骤报错，解决办法：再执行一次ansible-playbook  -i inventories/test/hosts etcd.yml</p>
</blockquote>
<p>3、服务校验：参考部署书册《BC-Deepwatch安装部署手册》2.5.1章节的“校验”部分</p>
<h2 id="五、安装docker以及harbor"><a href="#五、安装docker以及harbor" class="headerlink" title="五、安装docker以及harbor"></a>五、安装docker以及harbor</h2><p>1、登录deepwatch01</p>
<p>2、进入到 <code>/app/epic-autoluke</code> 目录下，执行如下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook  -i inventories/test/hosts harbor.yml</span><br></pre></td></tr></table></figure>

<p>3、 服务校验：参考部署书册《BC-Deepwatch安装部署手册》2.5.2-2.5.3章节的“校验”部分 ,或者参考以下</p>
<ol>
<li><p>​    进入harbor安装目录执行 docker-compose ps 出现下图所示，表示harbor组件为up状态</p>
<p><img src="C:%5CUsers%5Cuser%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5C1562756434378.png" alt="1562756434378"></p>
</li>
<li><p>在每个节点执行如下命令登录harbor。docker login <strong>IP</strong>   其中，IP为harbor安装的IP地址。</p>
</li>
<li><p>根据提示输入用户名和密码，然后在web界面输入harbor安装主机的IP进入harbor登录页面。</p>
</li>
<li><p>输入harbor用户名和密码进入harbor管理页面</p>
</li>
</ol>
<h2 id="六、安装k8s集群"><a href="#六、安装k8s集群" class="headerlink" title="六、安装k8s集群"></a>六、安装k8s集群</h2><p>1、部署前，先用命令 <code>systemctl status network</code> 检查每台节点的 <code>network</code> 状态是不是 <code>running</code> 状态</p>
<p>2、登录 deepwatch01，执行如下命令：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook -i inventories/<span class="built_in">test</span>/hosts kubernete.yml</span><br></pre></td></tr></table></figure>

<p>3、服务校验（仅需在deepwatch01上执行）：</p>
<ul>
<li>执行命令：<code>kubectl get pod -n kube-system</code>，查看所有 pod 状态均是 running 状态</li>
<li>执行命令：<code>kubectl exec -ti coredns-xxxx /bin/sh -n kube-system</code>，(coredns的pod全名)</li>
<li>进入容器后，依次 ping k8s 集群的各个节点地址，如果都能 ping 通，表示 coredns 工作正常</li>
</ul>
<p>4、异常处理</p>
<ol>
<li>如果执行上面的步骤 1 报错，或者 flannel、coredns 状态非 running，需要查看一下 kube-proxy 的日志，具体步骤：</li>
</ol>
<p><code>kubectl logs kube-proxy-xxx</code>，（kube-proxy 的 pod全名）</p>
<p>如果日志里显示关于“证书认证失效”类似的问题，说明 etcd 集群证书失效了。</p>
<p>解决办法，在 deepwatch01 节点上执行以下步骤：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /opt/install/kubernete</span><br><span class="line">kubectl delete -f kube-flannel.yaml</span><br><span class="line"><span class="built_in">cd</span> /app/epic-autoluke</span><br><span class="line">ansible-playbook -i inventories/<span class="built_in">test</span>/hosts etcd.yml</span><br><span class="line">ansible-playbook -i inventories/<span class="built_in">test</span>/hosts kubernete.yml</span><br></pre></td></tr></table></figure>

<p>执行完上述步骤后，再走一遍“服务校验”的流程观察是否生效</p>
<ol start="2">
<li>如果执行上面的步骤 1 正常，但是步骤 2 有问题，即 coredns 容器内部不能 ping 通三台节点，有可能是 iptables 的垃圾规则导致的。解决办法：在三台dw节点上执行以下步骤：</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">systemctl stop docker</span><br><span class="line">systemctl stop kubelet</span><br><span class="line">systemctl restart iptables</span><br><span class="line">systemctl restart docker</span><br><span class="line">systemctl restart kubelet</span><br></pre></td></tr></table></figure>

<p>在 deepwatch01 节点上执行以下步骤：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /opt/install/harbor/</span><br><span class="line">docker-compose down</span><br><span class="line">docker-compose up -d</span><br><span class="line">./login.sh</span><br></pre></td></tr></table></figure>

<p>执行完上述步骤后，再走一遍“服务校验”的流程观察是否生效</p>
<h2 id="七、安装haproxy"><a href="#七、安装haproxy" class="headerlink" title="七、安装haproxy"></a>七、安装haproxy</h2><p>1、登录deepwatch01</p>
<p>2、进入到 <code>/app/epic-autoluke</code> 目录下，执行如下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook  -i inventories/test/hosts haproxy.yml</span><br></pre></td></tr></table></figure>

<p>3、 服务校验：参考部署书册《BC-Deepwatch安装部署手册》2.11.1.2章节的“校验”部分</p>
<h2 id="八、安装keepalived"><a href="#八、安装keepalived" class="headerlink" title="八、安装keepalived"></a>八、安装keepalived</h2><p>1、登录deepwatch01</p>
<p>2、进入到 <code>/app/epic-autoluke</code> 目录下，执行如下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook  -i inventories/test/hosts keepalived.yml</span><br></pre></td></tr></table></figure>

<p>3、 服务校验：参考部署书册《BC-Deepwatch安装部署手册》2.11.1.3章节的“校验”部分</p>
<h2 id="九、安装glusterfs共享目录"><a href="#九、安装glusterfs共享目录" class="headerlink" title="九、安装glusterfs共享目录"></a>九、安装glusterfs共享目录</h2><p>1、登录deepwatch01</p>
<p>2、进入到 <code>/app/epic-autoluke</code> 目录下，执行如下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook  -i inventories/test/hosts glusterfs.yml</span><br></pre></td></tr></table></figure>

<p>3、 服务校验：参考部署书册《BC-Deepwatch安装部署手册》2.12章节的“校验”部分</p>
<h2 id="十、安装mysql集群"><a href="#十、安装mysql集群" class="headerlink" title="十、安装mysql集群"></a>十、安装mysql集群</h2><p>1、登录 deepwatch01</p>
<p>2、进入到 <code>/app/epic-autoluke</code> 目录下，执行如下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook  -i inventories/test/hosts mysql.yml</span><br></pre></td></tr></table></figure>

<p>3、 服务校验：</p>
<ol>
<li>三台机器上执行： <code>mysql -uroot -pEpic1234（mysql密码） -hxxxx（集群VIP） -P30118</code>，看能否成功登录</li>
<li>登录成功后，在第一台上执行：<code>create database testMysql;</code></li>
<li>三台机器上执行：<code>show databases;</code>，观察是否其余节点的数据库中也有 testMysql 这个数据库</li>
</ol>
<blockquote>
<p>注：如果校验的第一步出错，可试试执行：<code>mysqladmin -uroot -p password Epic1234（数据库密码） -hxxxx（集群VIP） -P30118</code>，然后会提示 <code>Enter password:</code> （Enter键即可）</p>
</blockquote>
<p>注意：在不少环境上出现过，由于 <strong>mariadb 的包冲突</strong>导致安装失败，解决办法：</p>
<p>在每台机器上执行下面步骤：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">rpm -qa|grep mariadb</span><br><span class="line">yum remove -y mariadb-xxxxx</span><br></pre></td></tr></table></figure>

<p>然后，在 deepwatch01 上再执行一次：<code>ansible-playbook  -i inventories/test/hosts mysql.yml</code></p>
<p><strong>注意</strong>：执行MySQL脚本的时候只要执行了set password with the first node这一步 之后在执行MySQL.yml就会报错 因为set密码只能执行一次。</p>
<h2 id="十一、部署dw运行在k8s容器中的服务"><a href="#十一、部署dw运行在k8s容器中的服务" class="headerlink" title="十一、部署dw运行在k8s容器中的服务"></a>十一、部署dw运行在k8s容器中的服务</h2><p>1、登录 deepwatch01</p>
<p>2、进入到 <code>/app/epic-autoluke</code> 目录下，执行如下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook  -i inventories/test/hosts deploy_service.yml</span><br></pre></td></tr></table></figure>

<p>3、 进入到 <code>/opt/install/dw/yamls/</code>，依次执行 <code>kubectl create -f xxx.yaml</code></p>
<h2 id="十二、部署graphite集群"><a href="#十二、部署graphite集群" class="headerlink" title="十二、部署graphite集群"></a>十二、部署graphite集群</h2><p>1、登录 deepwatch01</p>
<p>2、进入到 <code>/app/epic-autoluke</code> 目录下，执行如下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook  -i inventories/test/hosts graphite.yml</span><br></pre></td></tr></table></figure>

<p>3、 服务校验：参考部署书册《BC-Deepwatch安装部署手册》2.6章节的“校验”部分</p>
<h2 id="十三、部署sensu集群"><a href="#十三、部署sensu集群" class="headerlink" title="十三、部署sensu集群"></a>十三、部署sensu集群</h2><p>1、登录 deepwatch01</p>
<p>2、进入到 <code>/app/epic-autoluke</code> 目录下，执行如下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook  -i inventories/test/hosts sensu.yml</span><br></pre></td></tr></table></figure>

<p>3、 服务校验：参考部署书册《BC-Deepwatch安装部署手册》2.7章节的“校验”部分</p>
<h2 id="十四、部署elk集群"><a href="#十四、部署elk集群" class="headerlink" title="十四、部署elk集群"></a>十四、部署elk集群</h2><p>1、登录 deepwatch01</p>
<p>2、进入到 <code>/app/epic-autoluke</code> 目录下，执行如下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook  -i inventories/test/hosts elk.yml</span><br></pre></td></tr></table></figure>

<p>3、 服务校验：参考部署书册《BC-Deepwatch安装部署手册》2.9章节的“校验”部分</p>
<h2 id="十五、部署sensu-client"><a href="#十五、部署sensu-client" class="headerlink" title="十五、部署sensu-client"></a>十五、部署sensu-client</h2><p>1、编辑文件 <code>/app/epic-autoluke/inventories/test/hosts</code>，新增客户端的服务器信息</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># ----------------------  监控物理机 信息定义---------------------------------</span></span><br><span class="line"><span class="comment"># 需要将监控的设备分组，对于不同类型机器需要单独分组，已定义不同监控采集功能</span></span><br><span class="line"><span class="comment"># 比如，控制节点可以使用 controller 组，计算节点用 compute 组</span></span><br><span class="line"><span class="comment"># 配置到底需要监控哪些功能，请在 group_vars/(分组名称).yml 中配置</span></span><br><span class="line"></span><br><span class="line"><span class="string">[controller]</span></span><br><span class="line"><span class="number">80.104</span><span class="number">.48</span><span class="number">.41</span></span><br><span class="line"></span><br><span class="line"><span class="string">[controller:vars]</span></span><br><span class="line"><span class="comment"># SSH 纳管物理机的登录信息：</span></span><br><span class="line"><span class="comment"># host_key_checking： 如果使用密码登录 必须设置 host_key_checking=False</span></span><br><span class="line"><span class="comment"># ansible_ssh_user： 目前必须使用  root 用户登录。</span></span><br><span class="line"><span class="comment"># ansible_ssh_pass： 用户密码</span></span><br><span class="line"><span class="comment"># ansible_ssh_port： ssh 登录端口</span></span><br><span class="line"></span><br><span class="line"><span class="string">host_key_checking=False</span></span><br><span class="line"><span class="string">ansible_ssh_user=</span> <span class="string">root</span></span><br><span class="line"><span class="string">ansible_ssh_pass=</span> <span class="string">r00tme</span></span><br><span class="line"><span class="string">ansible_ssh_port=</span> <span class="number">22</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># compute 一般代表计算节点</span></span><br><span class="line"><span class="string">[compute]</span></span><br><span class="line"><span class="number">80.104</span><span class="number">.48</span><span class="string">.[51:71]</span></span><br><span class="line"></span><br><span class="line"><span class="string">[compute:vars]</span></span><br><span class="line"><span class="string">host_key_checking=False</span></span><br><span class="line"><span class="string">ansible_ssh_user=</span> <span class="string">root</span></span><br><span class="line"><span class="string">ansible_ssh_pass=</span> <span class="string">r00tme</span></span><br><span class="line"><span class="string">ansible_ssh_port=</span> <span class="number">22</span></span><br><span class="line"></span><br><span class="line"><span class="string">[physicalservers:children]</span></span><br><span class="line"><span class="string">controller</span></span><br><span class="line"><span class="string">compute</span></span><br><span class="line"></span><br><span class="line"><span class="string">[physicalservers:vars]</span></span><br><span class="line"><span class="comment"># check_yaml: 监控纳管机器的进程、端口的开关，开on，关off</span></span><br><span class="line"><span class="string">check_yaml=on</span></span><br><span class="line"><span class="string">host_key_checking=False</span></span><br><span class="line"><span class="string">ansible_ssh_user=root</span></span><br><span class="line"><span class="string">ansible_ssh_pass=Bcec@2018</span></span><br><span class="line"><span class="string">ansible_ssh_port=22</span></span><br></pre></td></tr></table></figure>

<p>2、配置进程监控</p>
<p>配置到底需要监控哪些功能，请根据 <code>inventories/test/hosts</code> 中的主机分组，在 group_vars/(分组名称).yml 中配置，比如</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">checks:</span></span><br><span class="line"><span class="attr">  process:</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">&#123;</span> <span class="attr">name:</span> <span class="string">nova-compute,</span> <span class="attr">keyword:</span> <span class="string">nova-compute</span> <span class="string">&#125;</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">&#123;</span> <span class="attr">name:</span> <span class="string">libvirtd,</span> <span class="attr">keyword:</span> <span class="string">libvirtd</span> <span class="string">&#125;</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">&#123;</span> <span class="attr">name:</span> <span class="string">ceilometer-compute,</span> <span class="attr">keyword:</span> <span class="string">ceilometer-agent-comput|grep</span> <span class="bullet">-v</span> <span class="string">ha</span> <span class="string">&#125;</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">&#123;</span> <span class="attr">name:</span> <span class="string">ceilometer-compute-ha,</span> <span class="attr">keyword:</span> <span class="string">ceilometer-compute-ha</span> <span class="string">&#125;</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">&#123;</span> <span class="attr">name:</span> <span class="string">neutron-openvswitch-agent,</span> <span class="attr">keyword:</span> <span class="string">neutron-openvswitch-agent</span> <span class="string">&#125;</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">&#123;</span> <span class="attr">name:</span> <span class="string">novaextension-agent,</span> <span class="attr">keyword:</span> <span class="string">novaextension-agent</span> <span class="string">&#125;</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">&#123;</span> <span class="attr">name:</span> <span class="string">ntpd,</span> <span class="attr">keyword:</span> <span class="string">/usr/sbin/ntpd</span> <span class="string">&#125;</span></span><br></pre></td></tr></table></figure>

<p>将进程告警的 <code>name</code> 和监控进程所需的关键字 <code>keyword</code> （能够 ps 到）配置好，删掉文件中其他不用的内容。</p>
<p>3、执行如下命令，开始安装</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ansible-playbook  -i inventories/<span class="built_in">test</span>/hosts sensu-client.yml</span><br></pre></td></tr></table></figure>

<h1 id="问题"><a href="#问题" class="headerlink" title="问题"></a>问题</h1><p>1、HAproxy 默认安装在 k8s 的前两个节点，若 k8s 和 graphite 分开部署，HAproxy 如何部署、配置？</p>
<p>2、Graphite 的 HAproxy 有两套配置，第十二步容器里面的，和第七步外部的</p>
<p>3、docker、docker-compose 存在重复安装的问题</p>
<p>4、sensu 的高可用仍然用的容器中的</p>
<p>5、ELK 只支持 3 节点，ELK 相关的配置文件不能写死</p>
<p>6、sensu-client 中的一些监控，不能所有的主机都加，需要加判断条件，文件<code>epic-autoluke/roles/sensu_client_deploy/tasks/checks.yml</code></p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">- name:</span> <span class="string">Template</span> <span class="string">some</span> <span class="string">checks</span></span><br><span class="line"><span class="attr">  template:</span></span><br><span class="line"><span class="attr">    src:</span> <span class="string">"<span class="template-variable">&#123;&#123; item.src &#125;&#125;</span>"</span></span><br><span class="line"><span class="attr">    dest:</span> <span class="string">"/opt/sensu/embedded/bin/plugins_linux/<span class="template-variable">&#123;&#123; item.dest &#125;&#125;</span>"</span></span><br><span class="line"><span class="attr">  with_items:</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">&#123;</span> <span class="attr">src:</span> <span class="string">check_dhcpip.sh.j2,</span> <span class="attr">dest:</span> <span class="string">check_dhcpip.sh</span> <span class="string">&#125;</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">&#123;</span> <span class="attr">src:</span> <span class="string">check_ironic_mtstate.j2,</span> <span class="attr">dest:</span> <span class="string">check_ironic_mtstate</span> <span class="string">&#125;</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">&#123;</span> <span class="attr">src:</span> <span class="string">rabbitmq_healthy_check.py.j2,</span> <span class="attr">dest:</span> <span class="string">rabbitmq_healthy_check.py</span> <span class="string">&#125;</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">&#123;</span> <span class="attr">src:</span> <span class="string">rabbitmq_messages_check.py.j2,</span> <span class="attr">dest:</span> <span class="string">rabbitmq_messages_check.py</span> <span class="string">&#125;</span></span><br></pre></td></tr></table></figure>

<p>7、进程监控，<code>process</code>、<code>common</code> 部门不配置的话是否会报错，需要加判断条件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">checks:</span><br><span class="line">  process:</span><br><span class="line">    - &#123; name: nova-compute, keyword: nova-compute &#125;</span><br><span class="line">    - &#123; name: libvirtd, keyword: libvirtd &#125;</span><br><span class="line"></span><br><span class="line">  common:</span><br><span class="line">    - &#123; name: check_ntp_status, command: &quot;/opt/sensu/embedded/bin/check_ntp_time -H &#123;&#123; NTP_HOST &#125;&#125; -w 5 -c 10&quot;, type: &quot;服务&quot;, alarm_title: &quot;ntp服务异常&quot; &#125;</span><br></pre></td></tr></table></figure>

<p>8、Haproxy、Keepalived、rabbitmq，都存在重复安装情况，收集需求，独立安装</p>

      
    </div>

    

    
      
    

    
    
    

    

    
      
    
    

    

    <footer class="post-footer">
      
        
          
        
        <div class="post-tags">
          
            <a href="/blog/tags/运维/" rel="tag"># 运维</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2019/07/24/hello-world/" rel="next" title="Hello World">
                <i class="fa fa-chevron-left"></i> Hello World
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2019/07/24/test/" rel="prev" title="test">
                test <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">

          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  
  <p class="site-author-name" itemprop="name">peachlin</p>
  <div class="site-description motion-element" itemprop="description">码农与UI设计师的博客 至美视觉</div>
</div>


  <nav class="site-state motion-element">
    
      <div class="site-state-item site-state-posts">
        
          <a href="/blog/archives/">
        
          <span class="site-state-item-count">3</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
    

    

    
      
      
      <div class="site-state-item site-state-tags">
        
          
            <a href="/blog/tags/">
          
        
        
        
          
        
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">标签</span>
        </a>
      </div>
    
  </nav>







  <div class="links-of-author motion-element">
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://github.com/peachlin" title="GitHub &rarr; https://github.com/peachlin" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="mailto:wangkun380@hotmail.com" title="E-Mail &rarr; mailto:wangkun380@hotmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
    
  </div>






  <div class="links-of-blogroll motion-element links-of-blogroll-block">
    <div class="links-of-blogroll-title">
      <i class="fa  fa-fw fa-link"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
      
        <li class="links-of-blogroll-item">
          <a href="http://www.baidu.com" title="http://www.baidu.com" rel="noopener" target="_blank">至美视觉</a>
        </li>
      
    </ul>
  </div>


          
          
        </div>
      </div>

      
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#基本信息"><span class="nav-number">1.</span> <span class="nav-text">基本信息</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#机器列表"><span class="nav-number">1.1.</span> <span class="nav-text">机器列表</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#机器硬件要求"><span class="nav-number">1.2.</span> <span class="nav-text">机器硬件要求</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#其他要求"><span class="nav-number">1.3.</span> <span class="nav-text">其他要求</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#模块说明"><span class="nav-number">1.4.</span> <span class="nav-text">模块说明</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#部署步骤"><span class="nav-number">2.</span> <span class="nav-text">部署步骤</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#0、安装包准备"><span class="nav-number">2.1.</span> <span class="nav-text">0、安装包准备</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#一、Ansible-安装配置"><span class="nav-number">2.2.</span> <span class="nav-text">一、Ansible 安装配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#二、环境信息配置"><span class="nav-number">2.3.</span> <span class="nav-text">二、环境信息配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#三、基础配置"><span class="nav-number">2.4.</span> <span class="nav-text">三、基础配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#四、部署-etcd-集群"><span class="nav-number">2.5.</span> <span class="nav-text">四、部署 etcd 集群</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#五、安装docker以及harbor"><span class="nav-number">2.6.</span> <span class="nav-text">五、安装docker以及harbor</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#六、安装k8s集群"><span class="nav-number">2.7.</span> <span class="nav-text">六、安装k8s集群</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#七、安装haproxy"><span class="nav-number">2.8.</span> <span class="nav-text">七、安装haproxy</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#八、安装keepalived"><span class="nav-number">2.9.</span> <span class="nav-text">八、安装keepalived</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#九、安装glusterfs共享目录"><span class="nav-number">2.10.</span> <span class="nav-text">九、安装glusterfs共享目录</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#十、安装mysql集群"><span class="nav-number">2.11.</span> <span class="nav-text">十、安装mysql集群</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#十一、部署dw运行在k8s容器中的服务"><span class="nav-number">2.12.</span> <span class="nav-text">十一、部署dw运行在k8s容器中的服务</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#十二、部署graphite集群"><span class="nav-number">2.13.</span> <span class="nav-text">十二、部署graphite集群</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#十三、部署sensu集群"><span class="nav-number">2.14.</span> <span class="nav-text">十三、部署sensu集群</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#十四、部署elk集群"><span class="nav-number">2.15.</span> <span class="nav-text">十四、部署elk集群</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#十五、部署sensu-client"><span class="nav-number">2.16.</span> <span class="nav-text">十五、部署sensu-client</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#问题"><span class="nav-number">3.</span> <span class="nav-text">问题</span></a></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      

      

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">peachlin</span>

  

  
</div>


  <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v3.9.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> v7.2.0</div>




        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

    

    

  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>
















  
  









  
  <script src="/blog/lib/jquery/index.js?v=3.4.1"></script>

  
  <script src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>




  <script src="/blog/js/utils.js?v=7.2.0"></script>

  <script src="/blog/js/motion.js?v=7.2.0"></script>



  
  


  <script src="/blog/js/schemes/muse.js?v=7.2.0"></script>



  
  <script src="/blog/js/scrollspy.js?v=7.2.0"></script>
<script src="/blog/js/post-details.js?v=7.2.0"></script>



  <script src="/blog/js/next-boot.js?v=7.2.0"></script>

  

  

  


  










  





















<script>
// GET RESPONSIVE HEIGHT PASSED FROM IFRAME

window.addEventListener("message", function(e) {
  var data = e.data;
  if ((typeof data === 'string') && (data.indexOf('ciu_embed') > -1)) {
    var featureID = data.split(':')[1];
    var height = data.split(':')[2];
    $(`iframe[data-feature=${featureID}]`).height(parseInt(height) + 30);
  }
}, false);
</script>



  <script>
    (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      bp.src = (curProtocol === 'https') ? 'https://zz.bdstatic.com/linksubmit/push.js' : 'http://push.zhanzhang.baidu.com/push.js';
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
    })();
  </script>






  

</body>
</html>
